#!/bin/sh

# 获取版本号
config=`sed -n '1p' config/index.js |awk -F '= ' '{print $2}'`
version=${config:1:4}

path=$(cd `dirname $0`; pwd)
folder='h5-bridgenews-background'

cd .nuxt/dist/client
tar -zcf $path/version/$version.cdn.tar.gz ./*

cd ../../..
tar -zcf $path/version/$version.source.tar.gz .nuxt assets server static package.json ecosystem.config.js node_modules config nuxt.config.js

scp ./version/$version.source.tar.gz tuijian@qk-front-4:/home/tuijian/app/$folder
ssh tuijian@qk-front-4 "cd /home/tuijian/app/$folder && sh update.sh $version"

echo 'qk-front-4 更新完成'
